/*
 * @Date: 2022-02-18 14:44:15
 * @LastEditors: wuyuxin
 * @LastEditTime: 2022-02-19 00:04:36
 * @FilePath: \webpack-learning\13_webpack的devServer\webpack.config.js
 * @description: 文件描述
 */
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
  // watch: true,
  // mode: "production",
  entry: "./src/index.js",
  output: {
    filename: "bundle.js",
    path: path.resolve(__dirname, './build'),
    publicPath: "./"
  },
  devServer: {
    hot: true,
    port: 8765
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './index.html'
    }),
    new ReactRefreshWebpackPlugin(),
    new VueLoaderPlugin()
  ],
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        use: "babel-loader"
      },
      {
        test: /\.vue$/i,
        use: "vue-loader"
      },
      {
        test: /\.css/i,
        use: [
          "style-loader",
          "css-loader"
        ]
      }
    ]
  }
}